package tests;

import common.Utils;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions;

public class DetailPage extends Utils {
    public static String url = detailUrl;
    public DetailPage() {
        super(url);
    }

    /**
     * 校验详情页是否正常加载
     */
    public void CheckPageRight() throws InterruptedException {
//        Thread.sleep(1000);
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("body > div.container > div.right > div > div.title")));
        //标题
        String title = driver.findElement(By.cssSelector("body > div.container > div.right > div > div.title")).getText();
        //发布时间
        String pushTime = driver.findElement(By.cssSelector("body > div.container > div.right > div > div.date")).getText();

        String content = driver.findElement(By.cssSelector("#detail")).getText();
        System.out.println("content:" + content);
        //内容
//        String content = driver.findElement(By.cssSelector("#detail")).getText();
        //编辑按钮
        String edit = driver.findElement(By.cssSelector("body > div.container > div.right > div > div.operating > button:nth-child(1)")).getText();
        //删除按钮
        String del = driver.findElement(By.cssSelector("body > div.container > div.right > div > div.operating > button:nth-child(2)")).getText();

//        System.out.println(title);
//        System.out.println(pushTime);
//        System.out.println(content);
//        System.out.println(edit);
//        System.out.println(del);
        //校验
        assert !title.isEmpty();
        assert !pushTime.isEmpty();
        assert !content.isEmpty();
        assert edit.equals("编辑");
        assert del.equals("删除");


    }

    /**
     * 编辑功能
     */

    /**
     * 删除功能
     */
}

























